Use gcc crate in native build script example
authorJeff Waugh <jdub@bethesignal.org>
Mon, 29 Jun 2015 06:19:17 +0000 (16:19 +1000)
committerJeff Waugh <jdub@bethesignal.org>
Mon, 29 Jun 2015 06:19:17 +0000 (16:19 +1000)
src/doc/build-script.md

index bdc7350b3636afcf2911a509f2da310a28270b5b..57e5bf7c0e4d44c57df68308b87d7a5e3ae56ba4 100644 (file)
@@ -350,17 +350,25 @@ portable, and standardized. For example, the build script could be written as:
 ```rust,ignore
 // build.rs
 
-// Bring in a dependency on an externally maintained `cc` package which manages
+// Bring in a dependency on an externally maintained `gcc` package which manages
 // invoking the C compiler.
-extern crate cc;
+extern crate gcc;
 
 fn main() {
-    cc::compile_library("libhello.a", &["src/hello.c"]).unwrap();
+    gcc::compile_library("libhello.a", &["src/hello.c"]).unwrap();
 }
 ```
 
-This example is a little hand-wavy, but we can assume that the `cc` crate
-performs tasks such as:
+Add a build time dependency on the `gcc` crate with the following addition to
+your `Cargo.toml`:
+
+```toml
+[build-dependencies]
+gcc = "0.3"
+```
+
+The [`gcc` crate](https://crates.io/crates/gcc) abstracts a range of build
+script requirements for C code:
 
 * It invokes the appropriate compiler (MSVC for windows, `gcc` for MinGW, `cc`
   for Unix platforms, etc).